﻿<UserControl x:Class="Haushaltsbuch.Views.Options.UserDetailView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:cal="http://www.caliburnproject.org"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">

    <Grid VerticalAlignment="Top" >
        <Grid.Resources>
            <Style TargetType="Label">
                <Style.Triggers>
                    <Trigger Property="Grid.Column" Value="0">
                        <Setter Property="HorizontalAlignment" Value="Right" />
                    </Trigger>
                </Style.Triggers>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Label Grid.Row="0">ID:</Label>
        <TextBlock Text="{Binding Model.Id}" Grid.Row="0" Grid.Column="1"/>

        <Label Grid.Row="1">Vorname:</Label>
        <TextBox Text="{Binding Model.Firstname}" Grid.Row="1" Grid.Column="1"/>
        
        <Label Grid.Row="2">Nachname:</Label>
        <TextBox Text="{Binding Model.Lastname}" Grid.Row="2" Grid.Column="1"/>
        
        <Label Grid.Row="3">Username:</Label>
        <TextBox Text="{Binding Model.Username}" Grid.Row="3" Grid.Column="1"/>

        <Grid Grid.Row="4" Grid.Column="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ListBox Grid.Column="0" ItemsSource="{Binding Model.Roles}" SelectedItem="{Binding SelectedLeftRole}" cal:Message.Attach="[MouseDoubleClick] = [Action MoveToRight]"  DisplayMemberPath="Name" />
        <ListBox Grid.Column="1" ItemsSource="{Binding AllRoles}" SelectedItem="{Binding SelectedRightRole}" cal:Message.Attach="[MouseDoubleClick] = [Action MoveToLeft]" DisplayMemberPath="Name" />
        </Grid>

        <Button Name="ChangePassword" Grid.Row="5" Grid.Column="1" > Passwort ändern</Button>
        <Button Name="Save" Grid.Row="6" Content="Speichern" />
    </Grid>

</UserControl>